package com.github.wj.security.server.controller;
import com.github.wj.orm.security.entity.Pager;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 通用方法
 * Created by 王建 on 2017/6/14.
 */
public interface AbstractBaseControllerInterface {

    /**
     * 列表页首页
     * @param modelMap
     * @return
     */
    String index(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap);

    /**
     * 列表页分页查询
     * @param modelMap
     * @param example
     * @param pager
     * @return
     */
    String index(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap, Object example, Pager pager);

    /**
     * 新增页面
     * @param modelMap
     * @return
     */
    String add(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap);

    /**
     * 保存，更新对象
     * @param modelMap
     * @param example

     * @return
     */
    String saveOrUpdate(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap, Object example);

    /**
     * 查看页面
     * @param modelMap
     * @param id
     * @return
     */
    String openEntity(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap, @PathVariable Long id);

    /**
     * 打开可编辑页面
     * @param modelMap
     * @param id
     * @return
     */
    String edit(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap, @PathVariable Long id);

    /**
     * 删除勾选项
     * @param ids
     * @return
     */
    String delete(HttpServletRequest request, HttpServletResponse response, @PathVariable String ids);

}
